//@author A0101038Y
//Task.h
//This is the header file for Task.cpp
#ifndef TASK_H
#define TASK_H
#include "entry.h"
#include <sstream>
class Task :
	public Entry
{
	static const string MSG_OUTPUT;
	bool _statusCompleted;

	/*//inherited attributes
	string _name;
	string _command;
	QDate _endDate;
	QTime _endTime;
	static const QDate EMPTY_DATE;
	static const QTime EMPTY_TIME;
	static const string EMPTY_STRING;
	friend class EntryManager;
	*/
public:
	static const int NUM_ATTRIBUTES=4;
	static const string TYPE_ENTRY;
	
	//constructor of Task
	Task(void);
	Task(const Entry*);
	Task(string, QDate, QTime, bool);

	//deconstructor of task
	~Task(void);
	
	//this function converts vector of strings into a string for storage.
	string toString();

	//this function sets the name of a task (currently unused)
	//pre-req: string
	//post-req: NIL
//	void setName(string);

	//This function loads strings from storage file to string in strings in format acceptable by Task.
	//Pre-req: strings
	//Post-req: Task
	static Task fromString(string);
	
	//This function gets the various private attributes of Entry to be used in Task.
	//Pre-req: Task
	//Post-req: return boolean value
	bool operator==(Entry*);
	
	//This function sets an Task as "Done"
	//Pre-req: NIL
	//Post-req: return boolean value
	bool setDone();
	
	//This function gets the status of a task.
	//Pre-req: NIL
	//Post-req: return boolean value associated with status of a task
	bool getStatus() const;
	
	//this function sets default setting for missing end time in task.
	//pre-req: NIL
	//post-req: NIL
	void setDefaultForMissingEndDateTime();
	
	//This function gets the status string
	//Pre-req: NIL
	//Post-req: NIL
	string getStatusString() const;
	
	//This function gets the entry type
	//Pre-req: NIL
	//Post-req: NIL
	string getEntryType() const;
	
	//This function searches the strings according to keyword
	//Pre-req: NIL
	//Post-req: return string
	string getSearchString() const ;
	
	//This function gets the attribute count
	//Pre-req: NIL
	//Post-req: return integer
	int getAttributeCount() const;
	
	//Enumeration of Status for Task
	enum STATUS_TYPE_TASK{
		DONE, NOT_DONE, OVERDUE
	};
	
	//This function send status task for Status Message Printing
	//Pre-req: status of task
	//Post-req: return string
	string sendStatusTask( const STATUS_TYPE_TASK status) const;
	
	//this function sets the status of a task as not done or overdue if current date time is past the stipulated end date time (deadline)
	//pre-req: Nil
	//post-req: returns string of status
	string setNotDoneOrOverdue () const;
	
	//this function checks whether the stipulated deadline is past.
	//pre-req:NIL
	//post-req: returns boolean value
	bool NotDoneOrOverdue () const;
	
	//this function sets default end date if such attribute is missing from storage file.
	//pre-req: NIL
	//post-req: NIL
	void setDefaultEndDate();
	
	//this function sets default end time if such attribute is missing from storage file.
	//pre-req: NIL
	//post-req: NIL
	void setDefaultEndTime();
	
	//this function sets default end date and time if such attributes are missing from storage file.
	//pre-req: NIL
	//post-req: NIL
	void setDefaultEndDateTime();
	
	static const string STATUS_DONE;
	static const string STATUS_NOT_DONE;
	static const string STATUS_OVERDUE;
	static const char* SEARCH_PLACEHOLDER;
	static const char* SEARCH_DATE_FORMAT;
	static const char* SEARCH_TIME_FORMAT;
};

#endif